package com.ly.heart.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.MeetingRoomMapper;
import com.ly.heart.service.IMeetingRoomService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.MeetingRoomEntity;

import javax.annotation.Resource;

/**
 * 会议室信息Service业务层处理
 *
 * @author cxl
 * @date 2024-06-13
 */
@Service
public class MeetingRoomServiceImpl extends ServiceImpl<MeetingRoomMapper,MeetingRoomEntity> implements IMeetingRoomService {

    @Resource
    private MeetingRoomMapper meetingRoomMapper;

    /**
     * 查询会议室信息
     *
     * @param id 会议室信息ID
     * @return 会议室信息
     */
    @Override
    public MeetingRoomEntity selectMeetingRoomEntityById(String id)
    {
        return meetingRoomMapper.selectMeetingRoomEntityById(id);
    }

    /**
     * 查询会议室信息列表
     *
     * @param meetingRoomEntity 会议室信息
     * @return 会议室信息
     */
    @Override
    public List<MeetingRoomEntity> selectMeetingRoomEntityList(MeetingRoomEntity meetingRoomEntity)
    {
        return meetingRoomMapper.selectMeetingRoomEntityList(meetingRoomEntity);
    }

    /**
     * 新增会议室信息
     *
     * @param meetingRoomEntity 会议室信息
     * @return 结果
     */
    @Override
    public int insertMeetingRoomEntity(MeetingRoomEntity meetingRoomEntity)
    {
        meetingRoomEntity.setId(SnowflakeIdWorker.getInstance().nextStringId());
        meetingRoomEntity.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
        meetingRoomEntity.setCreateTime(DateUtils.getNowDate());
        return meetingRoomMapper.insertMeetingRoomEntity(meetingRoomEntity);
    }

    /**
     * 修改会议室信息
     *
     * @param meetingRoomEntity 会议室信息
     * @return 结果
     */
    @Override
    public int updateMeetingRoomEntity(MeetingRoomEntity meetingRoomEntity)
    {
        meetingRoomEntity.setChangeTime(DateUtils.getNowDate());
        return meetingRoomMapper.updateMeetingRoomEntity(meetingRoomEntity);
    }

    /**
     * 批量删除会议室信息
     *
     * @param ids 需要删除的会议室信息ID
     * @return 结果
     */
    @Override
    public int deleteMeetingRoomEntityByIds(String[] ids)
    {
        return meetingRoomMapper.deleteMeetingRoomEntityByIds(ids);
    }

    /**
     * 删除会议室信息信息
     *
     * @param id 会议室信息ID
     * @return 结果
     */
    @Override
    public int deleteMeetingRoomEntityById(String id)
    {
        return meetingRoomMapper.deleteMeetingRoomEntityById(id);
    }

}
